home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Champak 146
/
(Vol 146) Jan 07 2012.iso
/
Games
/
shark_attack_2.swf
/
scripts
/
DefineSprite_93
/
frame_1
/
DoAction.as
Wrap
Text File
|
2012-01-07
|
3KB
|
115 lines
if(Key.isDown(65))
{
if(_parent.air != true && _parent._currentFrame < 3)
{
_parent.jumpspeed = _parent.jumpspeed_max;
_parent.jumping = true;
_parent.dest_y = _parent._y - 80;
_parent.gotoAndStop("jump");
}
}
if(Key.isDown(Key.RIGHT))
{
_parent.right = _parent.right + 1;
}
else
{
_parent.right = 0;
}
if(Key.isDown(Key.LEFT))
{
_parent.left = _parent.left + 1;
}
else
{
_parent.left = 0;
}
if((Key.isDown(Key.RIGHT) || Key.isDown(Key.LEFT)) && _parent.pushed != true)
{
_parent.walking = true;
}
else
{
_parent.walking = false;
}
if(Key.isDown(Key.RIGHT) && (_parent.left == 0 || _parent.right < _parent.left) && _parent.pushed != true)
{
_parent._x += _parent.speed;
if(200 < _parent._x == true && _root.level_limit + _parent.speed < _root.level._x)
{
_root.Scroll();
}
if(_parent._xscale < 0)
{
_parent._xscale *= -1;
}
}
if(Key.isDown(Key.LEFT) && (_parent.right == 0 || _parent.left < _parent.right) && _parent.pushed != true)
{
_parent._x -= _parent.speed;
if(0 < _parent._xscale)
{
_parent._xscale *= -1;
}
}
if(_parent._currentFrame == 1 && _parent.walking == true)
{
_parent.gotoAndStop("walk");
}
else if(_parent._currentFrame < 4 && _parent.jumping != true && _parent.air == true)
{
_parent.gotoAndStop("fall");
}
else if(_parent._currentFrame == 2 && _parent.walking == false || (_parent._currentFrame == 3 || _parent._currentFrame == 4) && _parent.air != true && _parent.jumping != true)
{
_parent.gotoAndStop("stand");
}
if(_root.rightlimit < _parent._x)
{
_parent._x = _root.rightlimit;
}
else if(_parent._x < _root.leftlimit)
{
_parent._x = _root.leftlimit;
}
if(_parent.air == true && _parent.jumping != true)
{
_parent._y += _parent.jumpspeed;
if(_parent.jumpspeed < _parent.jumpspeed_max)
{
_parent.jumpspeed += 2;
}
}
if(_parent.jumping == true && _parent.dest_y < _parent._y)
{
_parent._y -= _parent.jumpspeed;
if(_parent.jumpspeed_min < _parent.jumpspeed)
{
_parent.jumpspeed -= 2;
}
}
else
{
_parent.jumping = false;
}
if(_parent.pushed == true && _parent.jumping == true && _parent.dest_x + _parent.jumpspeed < _parent._x)
{
_parent._x -= _parent.jumpspeed;
if(0 < _parent._xscale)
{
_parent._xscale *= -1;
}
}
else if(_parent.pushed == true && _parent.jumping == true && _parent._x < _parent.dest_x - _parent.jumpspeed)
{
_parent._x += _parent.jumpspeed;
if(_parent._xscale < 0)
{
_parent._xscale *= -1;
}
}
else
{
_parent.pushed = false;
}